﻿Public Class SetInvoicedTimecardForm

    Private _orderNo As Guid
    Public Property ParamOrderNo As Guid
        Get
            Return _orderNo
        End Get
        Set(ByVal value As Guid)
            _orderNo = value
        End Set
    End Property

    Private _customerID As Guid
    Public Property ParamCustID As Guid
        Get
            Return _customerID
        End Get
        Set(ByVal value As Guid)
            _customerID = value
        End Set
    End Property


    Public Overridable Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub


    Public Overridable Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
        If Not String.IsNullOrEmpty(dtFrom.EditValue.ToString()) AndAlso Not String.IsNullOrEmpty(dtTo.EditValue.ToString()) AndAlso Not ParamOrderNo = Guid.Empty AndAlso Not ParamCustID = Guid.Empty Then
            Try
                SystemBoxSDK.PL.CRMSDK.SalesOrder_PL.InvoiceTimesheet(dtFrom.EditValue, dtTo.EditValue, ParamOrderNo, ParamCustID)
                Me.DialogResult = Windows.Forms.DialogResult.OK

            Catch ex As SqlClient.SqlException
                MessageWindow.ShowMessage(ex, MsgBoxStyle.OkOnly, False)
                Me.Close()
            End Try
        Else
            MessageWindow.ShowMessage("You must provide both dates", MsgBoxStyle.OkOnly, False)
        End If
    End Sub
End Class